package com.tianyang.yukuaifuzs.business.auth.adapter;

import android.widget.TextView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tianyang.yukuaifuzs.R;
import com.tianyang.yukuaifuzs.business.main.bean.PosUserOutput;
import com.tianyang.yukuaifuzs.common.utils.CommonUtils;
import com.tianyang.yukuaifuzs.utils.VerifyUtil;

import java.util.ArrayList;

/**
 * Description：商户入网中
 * Created by xyj on 2024/3/8
 */
public class MerchantSubmitAdapter extends BaseQuickAdapter<PosUserOutput, BaseViewHolder> {

    private boolean isRefuse = false;

    public MerchantSubmitAdapter(boolean isRefuse) {
        super(R.layout.item_merchant_submit, new ArrayList<>());
        this.isRefuse = isRefuse;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, PosUserOutput item) {
        if (item != null) {
            helper.setText(R.id.createTimeTv, VerifyUtil.checkString(item.getCreateDate()))
                    .addOnClickListener(R.id.updateTypeRtv)
                    .setText(R.id.mchTypeTv, item.getName() + "（" + CommonUtils.getMerchantName(item.getMchType()) + "）")
                    .setText(R.id.phoneTv, "联系商家 " + item.getPhone());
            TextView hintTv = helper.getView(R.id.hintTv);
            if (isRefuse) {
                hintTv.setText("查看驳回原因");
                helper.addOnClickListener(R.id.hintTv);
            } else {
                hintTv.setText("继续填写");
            }
        }
    }
}
